package com.patterns.composite.commonComposite;

import java.util.ArrayList;

/**
 * @Creation_time 2017/7/17
 * @Theme 树枝构件
 * @Autor Xiao Yiyun
 */
public class Composite extends Component {
    //构件容器
    private ArrayList<Component> componentArrayList = new ArrayList<Component>();
    //增加一个叶子构件或树枝构件
    public void add(Component component) {
        this.componentArrayList.add(component);
    }
    //删除一个叶子构件或树枝构件
    public ArrayList<Component> getChildren() {
        return this.componentArrayList;
    }
}
